﻿@{
    ViewBag.Title = "VisiToggler";
}

<h2>Visibility Toggler</h2>

<p>Allows to show/hide/toggle visiblity of a container.</p>

<h3>Sample #1</h3>

@using (Html.VisiToggler("show/hide"))
{
    <p>
        Sed rutrum accumsan lectus, ac mattis lectus tincidunt non. Integer blandit elementum tincidunt. Phasellus interdum felis a velit convallis ac rhoncus justo suscipit. 
        Accumsan accumsan odio id gravida. Quisque urna mauris, luctus quis pharetra id, pharetra in risus. Quisque imperdiet leo vitae velit rhoncus dapibus. Proin vitae nisl eget enim posuere egestas.
    </p>    
}

@Html.VisiTogglerFromPartial(CodeSamplesPartials.VISI_TOGGLER_SAMPLE1, Html.CreateVisiToggler("show the sample source code ", htmlAttributes: HtmlAttrs.CssClass("onright")), options: VisiOptions.HiddenByDefault)

<p>&nbsp;</p>

<h3>Sample #2</h3>

@{    
    var toggler2 = Html.CreateVisiToggler("show/hide #2", VisiOptions.SlideToggle | VisiOptions.Slow);

    @toggler2
    
    <p>Quisque urna mauris, luctus quis pharetra id, pharetra in risus.
           Quisque imperdiet leo vitae velit rhoncus dapibus.</p>
    
    using (Html.VisiToggler(toggler2, htmlAttributes: new { @class = "well" }))
    {
    <p>
        Sed rutrum accumsan lectus, ac mattis lectus tincidunt non. Integer blandit elementum tincidunt.
           Phasellus interdum felis a velit convallis ac rhoncus justo suscipit. 
           Accumsan accumsan odio id gravida. Quisque urna mauris, luctus quis pharetra id, pharetra in risus.
           Quisque imperdiet leo vitae velit rhoncus dapibus. Proin vitae nisl eget enim posuere egestas.
    </p>    
    }
    
    <p><a href="#" onclick="@toggler2.ToggleJS()">show/hide (javascript)</a></p>    
    <p><a href="#" onclick="@toggler2.ToggleJS(1000)">toggle and return back in 1 second (javascript)</a></p>
}

@Html.VisiTogglerFromPartial(CodeSamplesPartials.VISI_TOGGLER_SAMPLE2, Html.CreateVisiToggler("show the sample source code ", htmlAttributes: HtmlAttrs.CssClass("onright")), options: VisiOptions.HiddenByDefault)

<p>&nbsp;</p>

<h3>Sample #3</h3>

@{
    var togglerElement = Html.Container()
                        .Add<Img>("~/Images/icon-leaf.png", htmlAttributes: new
                        {
                            title = "this is toggler title",
                            width = 10,
                            height = 10
                        })
                        .Add(" show/hide #3");

    var toggler3 = Html.CreateVisiToggler(togglerElement, VisiOptions.FadeToggle | VisiOptions.Slow);

    using (Html.VisiToggler(toggler3))
    {
    <p>
        Sed rutrum accumsan lectus, ac mattis lectus tincidunt non. Integer blandit elementum tincidunt. Phasellus interdum felis a velit convallis ac rhoncus justo suscipit. 
        Accumsan accumsan odio id gravida. Quisque urna mauris, luctus quis pharetra id, pharetra in risus. Quisque imperdiet leo vitae velit rhoncus dapibus. Proin vitae nisl eget enim posuere egestas.
    </p>    
    }
}

@Html.VisiTogglerFromPartial(CodeSamplesPartials.VISI_TOGGLER_SAMPLE3, Html.CreateVisiToggler("show the sample source code ", htmlAttributes: HtmlAttrs.CssClass("onright")), options: VisiOptions.HiddenByDefault)

<h3>Sample #4</h3>

@Html.VisiTogglerFromPartial(VisiTogglePartials.PARTIAL1, "show/hide #4", htmlAttributes: new { @class = "well" })

@Html.VisiTogglerFromPartial(CodeSamplesPartials.VISI_TOGGLER_SAMPLE4, Html.CreateVisiToggler("show the sample source code ", htmlAttributes: HtmlAttrs.CssClass("onright")), options: VisiOptions.HiddenByDefault)
